<> Operator

Used to determine whether one expression is not equal to another. String comparisons are case-insensitive.


Syntax

result=expression1 <> expression2

PartTypeDescription
result Boolean Returns True if expression1 is not equal to expression2.
expression1 String, Number, Object, Color, or Date Any expression.
expression2 String, Number, Object, Color, or Date Any expression.


Notes

The data types of expression1 and expression2 must match. You can make comparisons between objects of any data type and between objects. If you compare objects, <> compares their references, not their contents. For example, when you compare two FolderItems, <> determines whether they have the same reference, not whether they point to the same file.

The <> operator is also used with objects to test whether they are Nil. For example, when you use the NewMemoryBlock function to create a new object, test whether the new object is Nil before proceeding.

Use StrComp to do a case-sensitive String comparison.

You can use Operator_Compare to define comparisons for classes.


Example

The following example uses <> to test for blank EditFields.

Dim a,b as Integer
If Editfield1.text <> "" and EditField2.text <> "" then
a= Val(Editfield1.text)
b= Val(EditField2.text)
If a<b then
MsgBox "A is Less Than B!"
else
Beep
end if
else
MsgBox "Please enter values into both boxes!"
end if

See Also

>, >=, <, <=, =, and StrComp operators; Operator_Compare function.